package org.ypx.center.service.impl;

import org.springframework.stereotype.Service;
import org.ypx.center.service.IUserTaskService;
import org.ypx.db.entity.UserTask;

/**
 * Created by tingwen on 2017/3/17.
 */
@Service
public class UserTaskServiceImpl extends BaseServiceImpl<UserTask> implements IUserTaskService {
    @Override
    public String getProgress() {
        UserTask userTask = new UserTask();
        int total = mapper.selectCount(userTask);
        if (total == 0) {
            return "0";
        }
        userTask.setIsOk(1);
        int complete = mapper.selectCount(userTask);
        double result = complete / total * 100;
        return String.format("%.2f", result);
    }



}
